var Md5 = require('../../utils/md5.js');
var timeSecond = Math.floor(Date.now() * 0.001);  //获取时间戳: 
var SignInfoData = Md5.hexMD5(timeSecond + 'nativetalk')//md5加密;
const app = getApp();
var httpNativetalk = app.globalData.httpNativetalk;
var httpWeike = app.globalData.httpWeike;
Page({
  data:{
    imgUrl: 'http://file.waijiaojun.com/waijiaojun/icon',
  },
  onLoad:function(e){
    var that=this;
    wx.request({
      url: httpNativetalk+'/app/9/course/list',
      data: {
        "cate_id": e.cateId,
      },
      header: {//请求头
        "Timestamp": timeSecond,
        "SignInfo": SignInfoData,
        "content-Type": "application/json",
        "client_type": "3",
        "version": 15,
        "token": '',
      },
      method: 'POST',
      success: function (res) {
        console.log(res);        
        if (res.data.obj.course==null){
          console.log("数据为空")
        } else {
          that.setData({
            courseData: res.data.obj.course
          })         
        };
      },
      fail: function (res) { },
      complete: function (res) { },
    })
  },
  ClassDetailFun:function(e){
    var classIds = e.currentTarget.dataset.classid;
    var titleData = e.currentTarget.dataset.titles;
    wx.navigateTo({
      url: '/pages/classDetail/classDetail?classId=' + classIds,
    });
    wx.setNavigationBarTitle({
      title: titleData,
    })
  }
})